import { Room } from '../../api/Room';
import { Card } from './Card';

export class CardBuilding extends Card {
	// 建造次数
	progress: number = 1;
	title(room: Room, user: string): string {
		const building = this.progress > 0 ? `未建成的` : '';
		return building + this.titleBuilding(room, user);
	}
	titleBuilding(room: Room, user: string): string {
		return '建筑牌';
	}
	desc(room: Room, user: string): string {
		const building = this.progress > 0 ? `建筑${this.progress}: 建成时: ` : '';
		return building + this.descBuilding(room, user);
	}
	descBuilding(room: Room, user: string): string {
		return '';
	}
	use(room: Room, user: string, target: string): void {
		if (this.progress > 0) {
			this.progress--;
			return;
		}
	}
	canToField(room: Room, user: string): boolean {
		return this.progress == 0;
	}
	turnStart(room: Room, user: string): void {
		if (this.progress) this.turnStartBuilding(room, user);
	}
	turnStartBuilding(room: Room, user: string) {}
	turnEnd(room: Room, user: string): void {
		if (this.progress) this.turnEndBuilding(room, user);
	}
	turnEndBuilding(room: Room, user: string): void {}
	priority(room: Room, user: string) {
		return this.progress > 0 ? 0 : 1;
	}
}
